package com.zhxt.fquery.exception;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;


/**
 * Created by malin on 2017/7/23.
 */
@ControllerAdvice(annotations = {RestController.class, Controller.class})
@ResponseBody
public class RestExceptionHandler {

    private static final Logger logger = LoggerFactory.getLogger(RestExceptionHandler.class);

    @ExceptionHandler
    @ResponseStatus
    public String runtimeExceptionHandler(Exception e) {
        logger.error("controller中出错了",e);
        return e.getMessage();
    }
}
